function saveData(form) {
    var res = "[";
    var isFirst = true;
    for (var i = 0; i < form.items.length; i++) {
        var item = form.items.get(i);
        if (item.name != 'paymentDetail' && item.name != 'paymentId' && item.name != 'contractNumber') {
            var element = isFirst ? "" : ",";
            element += String.format('{"fieldLabel": "{0}", "value": "{1}", "regex": "{2}", "regexText": "{3}", "hidden": {4}, "name": "{5}" }',
                    item.fieldLabel, item.getValue(), (item.regex) ? item.regex.source : '', item.regexText, item.hidden, item.name);

            res += element;
        }
        isFirst = false;
    }
    res += "]";
    return res;

}
function removeElementsFromForm(form) {
    form.removeAll();
}

function refreshGrid() {
    store.load();
}
function getValueByName(form, name) {
    for (var i = 0; i < form.items.length; i++) {
        var item = form.items.get(i);
        if (item.name == name) {
            return item.getValue();
        }
    }

    return null;
}